Next: Sending Mail, Previous: Reading Mail, Up: Top [Contents][Index]
This chapter discusses the things you can do with folders within MH-E. The commands in this chapter are also found in the ‘Folder’ and ‘Message’ menus.
Display cheat sheet for the commands of the current prefix
in minibuffer (mh-prefix-help).
Display messages in any sequence
(mh-index-sequenced-messages).
Undo all refiles and deletes in the current folder
(mh-undo-folder).
Toggle between MH-Folder and MH-Folder Show modes
(mh-toggle-showing).
Process outstanding delete and refile requests
(mh-execute-commands).
The ‘mh-folder’ customization group is used to tune these commands.
mh-new-messages-folders Folders searched for the ‘unseen’
sequence (default: Inbox).
mh-ticked-messages-folders Folders searched for mh-tick-seq (default:
t).
mh-large-folder The number of messages that indicates a large folder (default: 200).
mh-recenter-summary-flag On means to recenter the summary window (default: ‘off’).
mh-recursive-folders-flag On means that commands which operate on folders do so recursively (default: ‘off’).
mh-sortm-args Additional arguments for sortm (default:
nil).
The following hooks are available.
mh-after-commands-processed-hook Hook run by x after performing outstanding
refile and delete requests (default: nil).
mh-before-commands-processed-hook Hook run by x before performing outstanding
refile and delete requests (default: nil).
mh-before-quit-hook Hook run by q before quitting MH-E (default:
nil).
mh-folder-mode-hook Hook run by mh-folder-mode when visiting a
new folder (default: nil).
mh-kill-folder-suppress-prompt-hook
Abnormal hook run at the beginning of
mh-kill-folder (default:
'mh-search-p).
mh-pack-folder-hook Hook run by mh-pack-folder after renumbering
the messages (default: nil).
mh-quit-hook Hook run by q after quitting MH-E (default:
nil).
mh-refile-msg-hook Hook run by o after marking each message for refiling
(default: nil).
The following faces are available for customizing the appearance of the MH-Folder buffer. See Scan Line Formats.
mh-folder-address Recipient face.
mh-folder-body Body text face.
mh-folder-cur-msg-number Current message number face.
mh-folder-date Date face.
mh-folder-deleted Deleted message face.
mh-folder-followup ‘Re:’ face.
mh-folder-msg-number Message number face.
mh-folder-refiled mh-folder-sent-to-me-hint Fontification hint face in messages sent directly to us.
The detection of messages sent to us is governed by the scan
format mh-scan-format-nmh and regular expression
mh-scan-sent-to-me-sender-regexp.
mh-folder-scan-format Sender face in messages sent directly to us. The detection
of messages sent to us is governed by the scan format
mh-scan-format-nmh and regular expression
mh-scan-sent-to-me-sender-regexp.
mh-folder-subject Subject face.
mh-folder-tick Ticked message face.
mh-folder-to ‘To:’ face.
The hook mh-folder-mode-hook is called when
visiting a new folder in MH-Folder mode. This could be used to
set your own key bindings, for example:
(defvar my-mh-init-done nil "Non-nil when one-time MH-E settings made.") (defun my-mh-folder-mode-hook () "Hook to set key bindings in MH-Folder mode." (if (not my-mh-init-done) ; only need to bind the keys once (progn (local-set-key "//" 'my-search-msg) (local-set-key "b" 'mh-burst-digest) ; better use of b (setq my-mh-init-done t)))) (add-hook 'mh-folder-mode-hook 'my-mh-folder-mode-hook) (defun my-search-msg () "Search for a regexp in the current message." (interactive) ; user function (save-window-excursion (other-window 1) ; go to next window (isearch-forward-regexp))) ; string search; hit return ; when done Create additional key bindings via mh-folder-mode-hook
MH-E has analogies for each of the MH folder and
refile commands27. To refile a message in another
folder, use the command o (mh-refile-msg)
(mnemonic: “output”). You are prompted for the folder
name (see Folder
Selection). Note that this command can also be used to create
folders. If you specify a folder that does not exist, you will be
prompted to create it. The hook mh-refile-msg-hook
is called after a message is marked to be refiled.
If you are refiling several messages into the same folder, you
can use the command !
(mh-refile-or-write-again) to repeat the last refile
or write (for the description of >
(mh-write-msg-to-file), see Files and Pipes). You
can use a range in either case (for example, C-u o 1 3 5-7
last:5 frombob RET, see Ranges).
If you’ve deleted a message or refiled it, but changed
your mind, you can cancel the action before you’ve executed
it. Use u (mh-undo) to undo a refile on
or deletion of a single message. You can also undo refiles and
deletes for messages that are found in a given range (see
Ranges).
Alternatively, you can use F u
(mh-undo-folder) to undo all refiles and deletes in
the current folder.
If you’ve marked messages to be deleted or refiled and
you want to go ahead and delete or refile the messages, use
x (mh-execute-commands). Many MH-E
commands that may affect the numbering of the messages (such as
F r or F p) will ask if you want to process
refiles or deletes first and then either run x for you
or undo the pending refiles and deletes.
The command x runs
mh-before-commands-processed-hook before the
commands are processed and
mh-after-commands-processed-hook after the commands
are processed. Variables that are useful with the former hook
include mh-delete-list and
mh-refile-list which can be used to see which
changes will be made to the current folder,
mh-current-folder. Variables that are useful with
the latter hook include mh-folders-changed, which
lists which folders were affected by deletes and refiles. This
list will always include the current folder
mh-current-folder.
If you wish to copy a message to another folder, you can use
the command c (mh-copy-msg) (see the
-link argument to refile(1)). Like the
command o, this command prompts you for the name of
the target folder and you can specify a range (see Ranges). Note that unlike the command
o, the copy takes place immediately. The original copy
remains in the current folder.
The command t (mh-toggle-showing)
switches between MH-Folder mode and MH-Folder Show mode28. MH-Folder
mode turns off the associated show buffer so that you can perform
operations on the messages quickly without reading them. This is
an excellent way to prune out your junk mail or to refile a group
of messages to another folder for later examination.
When you use t to toggle from MH-Folder Show mode
to MH-Folder mode, the MH-Show buffer is hidden and the MH-Folder
buffer is left alone. Setting
mh-recenter-summary-flag to a non-nil
value causes the toggle to display as many scan lines as
possible, with the cursor at the middle. The effect of
mh-recenter-summary-flag is rather useful, but it
can be annoying on a slow network connection.
When you want to read the messages that you have refiled into
folders, use the command F v
(mh-visit-folder) to visit the folder. You are
prompted for the folder name. The folder buffer will show just
unseen messages if there are any; otherwise, it will show all the
messages in the buffer as long there are fewer than
mh-large-folder messages. If there are more, then
you are prompted for a range of messages to scan. You can provide
a prefix argument in order to specify a range of messages to show
when you visit the folder (see Ranges). In this case, regions are not
used to specify the range and mh-large-folder is
ignored. Note that this command can also be used to create
folders. If you specify a folder that does not exist, you will be
prompted to create it.
If you forget where you’ve refiled your messages, you
can find them using F s (mh-search). See
Searching.
If you use a program such as procmail to file
your incoming mail automatically, you can display new, unseen,
messages using the command F n
(mh-index-new-messages). All messages in the
‘unseen’ sequence from the folders in
mh-new-messages-folders are listed. However, this
list of folders can be overridden with a prefix argument: with a
prefix argument, enter a space-separated list of folders, or
nothing to search all folders.
If you have ticked messages (see Sequences), you can display them
using the command F '
(mh-index-ticked-messages). All messages in the
‘tick’ sequence from the folders in
mh-ticked-messages-folders are listed. With a prefix
argument, enter a space-separated list of folders, or nothing to
search all folders.
You can display messages in any sequence with the command
F q (mh-index-sequenced-messages). All
messages from the folders in mh-new-messages-folders
in the sequence you provide are listed. With a prefix argument,
enter a space-separated list of folders at the prompt, or nothing
to search all folders.
Set the options mh-new-messages-folders and
mh-ticked-messages-folders to
‘Inbox’ to search the
‘+inbox’ folder or
‘All’ to search all of the top level
folders. Otherwise, list the folders that should be searched with
the ‘Choose Folders’ menu item. See
mh-recursive-folders-flag.
Other commands you can perform on folders include: F
l (mh-list-folders), to place a listing of all
the folders in your mail directory in a buffer called *MH-E
Folders* (see Miscellaneous); F
k (mh-kill-folder), to remove a folder; F
S (mh-sort-folder), to sort the messages by
date (see sortm(1) to see how to sort by other
criteria); F p (mh-pack-folder), to pack
a folder, removing gaps from the numbering sequence; and F
r (mh-rescan-folder), to rescan the folder,
which is useful to grab all messages in your
‘+inbox’ after processing your new mail
for the first time. If you don’t want to rescan the entire
folder, the commands F r or F p will accept
a range (see Ranges).
The command F p runs
mh-pack-folder-hook after renumbering the messages.
A variable that is useful with this hook is
mh-current-folder.
By default, operations on folders work only one level at a
time. Set mh-recursive-folders-flag to
non-nil to operate on all folders. This mostly means
that you’ll be able to see all your folders when you press
TAB when prompted for a folder
name.
The hook mh-kill-folder-suppress-prompt-functions
is an abnormal hook run at the beginning of the command
k. The hook functions are called with no arguments and
should return a non-nil value to suppress the normal
prompt when you remove a folder. This is useful for folders that
are easily regenerated. The default value of
mh-search-p suppresses the prompt on folders
generated by searching.
Use this hook with care. If there is a bug in your hook which returns
ton ‘+inbox’ and you press k by accident in the+inboxfolder, you will not be happy.
The option mh-sortm-args holds extra arguments to
pass on to the command sortm29 when a prefix argument is
used with F S. Normally default arguments to
sortm are specified in the MH profile. This option
may be used to provide an alternate view. For example,
‘'(\"-nolimit\" \"-textfield\"
\"subject\")’ is a useful setting.
When you want to quit using MH-E and go back to editing, you
can use the q (mh-quit) command. This
buries the buffers of the current MH-E folder and restores the
buffers that were present when you first ran M-x
mh-rmail. It also removes any MH-E working buffers whose
name begins with ‘ *mh-’ or
*MH-E (see Miscellaneous). You can
later restore your MH-E session by selecting the
‘+inbox’ buffer or by running M-x
mh-rmail again.
The two hooks mh-before-quit-hook and
mh-quit-hook are called by q. The former
one is called before the quit occurs, so you might use it to
perform any MH-E operations; you could perform some query and
abort the quit or call mh-execute-commands, for
example. The latter is not run in an MH-E context, so you might
use it to modify the window setup. If you find that q
buries a lot of buffers that you would rather remove, you can use
both mh-before-quit-hook and
mh-quit-hook to accomplish that.
(defvar my-mh-folder-buffer-to-delete nil
"Folder buffer that is being quit.")
(defun my-mh-before-quit-hook ()
"Save folder buffer that is to be deleted."
(setq my-mh-folder-buffer-to-delete (current-buffer)))
(defun my-mh-quit-hook ()
"Kill folder buffer rather than just bury it."
(set-buffer my-mh-folder-buffer-to-delete)
(if (get-buffer mh-show-buffer)
(kill-buffer mh-show-buffer))
(kill-buffer (current-buffer)))
Kill MH-Folder buffer instead of burying it
You can use dired to manipulate the folders themselves. For
example, I renamed my ‘+out’ folder to
the more common ‘+outbox’ by running
dired on my mail directory (M-x dired RET ~/Mail RET),
moving my cursor to ‘out’ and using the
command R (dired-do-rename).
See the sections Your Current Folder: folder and Moving and Linking Messages: refile in the MH book.
For you Emacs wizards, this is implemented as an Emacs minor mode.
See the section Sorting Messages: sortm in the MH book.
Next: Sending Mail, Previous: Reading Mail, Up: Top [Contents][Index]